#!/bin/sh
# Bug reports and comments to Igor.Ermolaev@intel.com
base=$(dirname $(readlink -f ${BASH_SOURCE[0]:-$0}))
pknb="$1";pflt="$2";shift 2
psfx=".${pknb##*.}"
if [ "$psfx" == '.txt' ]; then
   pknb="${pknb%$psfx}"
else
   unset psfx
fi
pdir=`mktemp -td 'pipe.XXXXXXXX'`
pipe=`mktemp -up "$pdir" ${psfx:+--suffix=$psfx }'pipe.XXXXXXXX'`
mkfifo "$pipe"
pnme="${pipe%$psfx}"
($base/run_sde "$@" "$pknb" "$pnme" &>/dev/null)&
grep "$pflt" "$pipe"
rm -f "$pipe";rmdir "$pdir"
